﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Catalog.CatalogItems;

namespace Catalog.CatalogTypes
{
    public class MusicCatalog : Catalog
    {
        static MusicCatalog()
        {
            AvailableMusic = new HashSet<Music>();
        }

        private MusicCatalog()
        {
        }

        public static HashSet<Music> AvailableMusic { get; set; }

        public static void AddNewItem(Music music)
        {
            AvailableMusic.Add(music);

            Catalog.AddNewItem(music);
        }

        public static void RemoveItem(Music music)
        {
            AvailableMusic.Remove(music);

            Catalog.RemoveItem(music);
        }

        public static string ShowAllFilms()
        {
            return MusicCatalog.ToString();
        }

        static new string ToString()
        {
            StringBuilder result = new StringBuilder();

            if (AvailableMusic.Count > 0)
            {
                result.AppendLine("All music: ");

                foreach (var item in AvailableMusic)
                {
                    result.AppendLine(string.Format("    {0}", item.ToString()));
                }
            }

            return result.ToString();
        }
    }
}